package com.study.javaOther.bishi;

/**
 * @ClassName: TreeNode
 * @Description:
 * @author: 王胜
 * @date 2021/6/21
 * @Version: 1.0
 **/
public class TreeNode {
    String nodeName;
    TreeNode[] childrenNodes = new TreeNode[0];

    public TreeNode() {
    }

    public TreeNode(String s) {
        this.nodeName = s;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public TreeNode[] getChildrenNodes() {
        return childrenNodes;
    }

    public void setChildrenNodes(TreeNode[] childrenNodes) {
        this.childrenNodes = childrenNodes;
    }

    public void addChildren(TreeNode node) {
        if (node == null) {
            return;
        }
        TreeNode[] childrenNodes = new TreeNode[this.childrenNodes.length + 1];
        for (int i = 0; i < this.childrenNodes.length; i++) {
            childrenNodes[i] = this.childrenNodes[i];
        }
        childrenNodes[this.childrenNodes.length] = node;
        this.childrenNodes = childrenNodes;
    }
}
